<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>同步和异步</title>
</head>
<body>
<script type="text/javascript">
    window.onload=function (){
    document.getElementById("btn1").onclick=function (){
        var xhr = new XMLHttpRequest();
        xhr.onreadystatechange=function (){
            if (this.readyState == 4) {
                if (this.status == 200) {
                    document.getElementById("div").innerHTML=this.responseText
                }
            }

        }
        xhr.open("GET","/ajax/ajaxrequest7?L="+new Date().getTime(),true)
        xhr.send()
    }
        document.getElementById("btn2").onclick=function (){
            var xhr = new XMLHttpRequest();
            xhr.onreadystatechange=function (){
                if (this.readyState == 4) {
                    if (this.status == 200) {
                        document.getElementById("div1").innerHTML=this.responseText
                    }
                }

            }
            xhr.open("GET","/ajax/ajaxrequest6?L="+new Date().getTime(),true)
            xhr.send()
        }
    }

</script>

<button id="btn1">请求1</button>

<div id="div"></div>

<button id="btn2">请求2</button>

<div id="div1"></div>
</body>
</html>